import Axios from "axios"
export default {
    namespaced: true,
    state: () => ({
        posts: []
    }),
    mutations: {
        setPosts(state, info) {
            state.posts = info
        }
    },
    actions: {
        async getPosts({ commit }) {
            const { data } = await Axios.get('https://cnodejs.org/api/v1/topics')
            commit('setPosts', data.data)
        }
    }
}